Skip to content

STY: Prefer using pytest temporary path fixtures in tests - #137

Open
jhlegarreta wants to merge 1 commit into
tee-ar-ex:masterfrom
jhlegarreta:sty/pytest-temp-path-fixture-leftbehind
Open

STY: Prefer using pytest temporary path fixtures in tests#137
jhlegarreta wants to merge 1 commit into
tee-ar-ex:masterfrom
jhlegarreta:sty/pytest-temp-path-fixture-leftbehind

Conversation

@jhlegarreta

@jhlegarreta jhlegarreta commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Prefer using the pytest tmp_path fixture in tests over the standard library tempfile.TemporaryDirectory().

In the previous implementation, the context was ensuring that the memmap files did not live past the context, failing to check anything that the trx function at issue would do in terms of the file survival. Since close_or_delete_mmap does not actually delete the file, and test_close_or_delete_mmap_with_mmap_attr actually checks that the memmap has been closed, this patch set checks that the file is still present after calling the function; pytest takes care of deleting the file once the testing function has finished its execution.

Left behind in commit 25cc109.

@jhlegarreta
jhlegarreta force-pushed the sty/pytest-temp-path-fixture-leftbehind branch 7 times, most recently from 6b4c7f1 to d07d3e1 Compare August 26, 2026 19:19
Prefer using the `pytest` `tmp_path` fixture in tests over the standard
library `tempfile.TemporaryDirectory()`.

In the previous implementation, the context was ensuring that the memmap
files did not live past the context, failing to check anything that the
`trx` function at issue would do in terms of the file survival. Since
`close_or_delete_mmap` does not actually delete the file, and
`test_close_or_delete_mmap_with_mmap_attr` actually checks that the
memmap has been closed, this patch set checks that the file is still
present after calling the function; `pytest` takes care of deleting the
file once the testing function has finished its execution.

Left behind in commit 25cc109.
@jhlegarreta
jhlegarreta force-pushed the sty/pytest-temp-path-fixture-leftbehind branch from d07d3e1 to c7a97e2 Compare August 26, 2026 19:27
@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.46%. Comparing base (0b27b2b) to head (c7a97e2).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #137      +/-   ##
==========================================
- Coverage   86.49%   86.46%   -0.03%     
==========================================
  Files          13       13              
  Lines        2887     2881       -6     
==========================================
- Hits         2497     2491       -6     
  Misses        390      390              
Flag Coverage Δ
unittests 86.46% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant